<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%String path = request.getContextPath();%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>客户额度管理</title>
    <jsp:include page="../../import.jsp" flush="true"/>
    <style type="text/css">
        .searchArea .fieldBox .label{width: 60px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;}
    </style>
</head>

<body class="iframeBody">
<div class="Wrapper">
    <div class="searchArea">
        <form id="searchBar">
            <div class="fieldset1 clearFix">
                <div class="fieldBox col_33">
                    <div class="label">客户名称</div>
                    <div class="field">
                        <input name="cstNm" id="cstNm" type="text" class="ui-textbox" value="">
                    </div>
                </div>
                <div class="fieldBox col_33">
                    <div class="label">手机号</div>
                    <div class="field">
                        <input name="mp" id="mp" type="text" class="ui-textbox" value="">
                    </div>
                </div>
                <div class="fieldBox col_33">
                    <div class="label">是否有效</div>
                    <div class="field">
                    <select name="isValid"  id="isValid">
                     	 <option value=" " selected="selected">请选择</option>
                     	 <option value="1">是</option>
		                 <option value="0">否</option>
	               </select>
	               </div>
                </div>
                <div class="clearFix"></div>
                <div class="btnsBox">
                    <span id="searchBtn" class="sq-button sq-button-round">查询</span>
                    <span id="clearBtn" class="sq-button sq-button-round">清空</span>
                    <input id="resetBtn" type="reset" value="重置" class="l-button l-button-reset Hide"/>
                </div>
            </div>
        </form>
    </div>
    <div id="ligergrid1" class="sq-grid"></div>
</div>

<script type="text/javascript">
    var grid = null, callback = null;
    $(function () {
        grid = $("#ligergrid1").ligerGrid({
            url: '<%=path%>/mcr/mcrCstCrLimSch/initList.do',
            method: 'get',
            columns: [
                {display: '客户名称', name: 'cstNm', minWidth: 80, align: 'center',
                    render:function(rowdata,rowindex,value){
                        return '<a href="javascript:;" onclick="showCstDtl('+rowdata.cstId+')"><span class="gridTip" title="客户查看">'+rowdata.cstNm+'</span></a>';
                    }
                },
                {display: '电话', name: 'mp', minWidth: 100, align: 'center', enabledSort: false},
                {display: 'A卡等级', name: 'thdResult', minWidth: 120, align: 'center',
                	render:function(rowdata,rowindex,value){
                		if(rowdata.thdResult!=null){
                			if(rowdata.thdResult == '1'){
                				return '<span class="gridTip" style="cursor: pointer;" title="通过">通过</span>';
                			}
                			return '<span class="gridTip" style="cursor: pointer;" title="' + rowdata.thdResult + '">' + rowdata.thdResult + '</span>';
                		}
                	}
                },
                {display: '客户类型', name: 'cstTypCd', minWidth: 120, align: 'center',
                    render:function(rowdata,rowindex,value){
                        if(rowdata.cstTypCd!=null){
                            if(rowdata.cstTypCd == '1'){
                                return '<span class="gridTip" style="cursor: pointer;" title="外部">外部</span>';
                            }
                            if(rowdata.cstTypCd == '0'){
                                return '<span class="gridTip" style="cursor: pointer;" title="内部">内部</span>';
                            }
                            return '<span class="gridTip" style="cursor: pointer;" title="' + rowdata.cstTypCd + '">' + rowdata.cstTypCd + '</span>';
                        }
                    }
                },
                {display: ' 准入支付表数量 ', name: 'zrPayAmount', minWidth: 120, align: 'center',
                	render:function(rowdata,rowindex,value){
                		if(rowdata.zrPayAmount!=null){
                			if(rowdata.zrPayAmount != null){
                                return '<span class="gridTip" style="cursor: pointer;" title="' + rowdata.zrPayAmount + '">' + rowdata.zrPayAmount + '</span>';
                			}
                		}
                	}
                },
                {display: ' 小贷逾期命中原因 ', name: 'xdResult', minWidth: 120, align: 'center',
                	render:function(rowdata,rowindex,value){
                		if(rowdata.xdResult!=null){
                			return '<span class="gridTip" style="cursor: pointer;" title="' + rowdata.xdResult + '">' + rowdata.xdResult + '</span>';
                		}
                	}
                },
                {display: '黑名单', name: 'xdBlack', minWidth: 120, align: 'center',
                	render:function(rowdata,rowindex,value){
                        if(rowdata.xdBlack!=null){
                            return '<span class="gridTip" style="cursor: pointer;" title="' + rowdata.xdBlack + '">' + rowdata.xdBlack + '</span>';
                        }
                	}
                },
                {display: '开放城市', name: 'openCity', minWidth: 120, align: 'center',
                	render:function(rowdata,rowindex,value){
                		if(rowdata.openCity!=null){
                			if(rowdata.openCity == '1'){
                				return '<span class="gridTip" style="cursor: pointer;" title="通过">通过</span>';
                			}
                			return '<span class="gridTip" style="cursor: pointer;" title="' + rowdata.openCity + '">' + rowdata.openCity + '</span>';
                		}
                	}
                },
                {display: '外部预授信', name: 'preCreditAmt', minWidth: 120, align: 'center',
                    render:function(rowdata,rowindex,value){
                        if(rowdata.preCreditAmt!=null){
                            return '<span class="gridTip" style="cursor: pointer;" title="' + rowdata.preCreditAmt + '">' + rowdata.preCreditAmt + '</span>';
                        }
                    }
                },
                {display: '用户本次授信', name: 'currentCredit', minWidth: 120, align: 'center',
                	render:function(rowdata,rowindex,value){
                        if(rowdata.currentCredit!=null&&!isNaN(rowdata.currentCredit)){
                            return '<span class="gridTip" style="cursor: pointer;" title="' + ((rowdata.currentCredit)/100).toFixed(2) + '">' + ((rowdata.currentCredit)/100).toFixed(2) + '</span>';
                        }else{
                            return rowdata.currentCredit;
                        }
                	}
                },
                {display: '用户本次可用授信', name: 'currentPermittedCredit', minWidth: 120, align: 'center',
                	render:function(rowdata,rowindex,value){
                        if(rowdata.currentPermittedCredit!=null&&!isNaN(rowdata.currentPermittedCredit)){
                            return '<span class="gridTip" style="cursor: pointer;" title="' + ((rowdata.currentPermittedCredit)/100).toFixed(2) + '">' + ((rowdata.currentPermittedCredit)/100).toFixed(2) + '</span>';
                        }else{
                            return rowdata.currentPermittedCredit;
                        }
                	}
                },
                {display: '用户类型详情', name: 'prjType', minWidth: 120, align: 'center',
                	render:function(rowdata,rowindex,value){
                		if(rowdata.prjType!=null){
                			return '<span class="gridTip" style="cursor: pointer;" title="' + rowdata.prjType + '">' + rowdata.prjType + '</span>';
                		}
                	}
                },
                {display: '是否有效', name: 'isValid', minWidth: 40, align: 'center', 
                	render:function(rowdata,index,value){
                        if(rowdata.isValid){
                        	return "是";
                        }else{
                        	return "否";
                        }
                    }
                },
                {display: '创建日期', name: 'crtTm', minWidth: 100, align: 'center', enabledSort: false,render:renderDate},
            ],
            pageSize: 10,
            root: 'rows',
            record: 'total',
            hideLoadButton: true,
            width: '100%',
            height: '100%',
            heightDiff: -2,
            checkbox: false,
            rownumbers: true,
            allowUnSelectRow: true,
            alternatingRow: false
        });
        grid.setHeight(100);

        $("#searchBar").ligerForm();

        /* 查询 */
        $("#searchBtn").click(function (event) {
            var form = liger.get("searchBar");
            var data = form.getData();
            for (name in data) {
                grid.setParm(name, data[name]);
            }
            grid.reload();
        });

        /* 清空 */
        $("#clearBtn").click(function (event) {
            clearLigerForm("searchBar");
        });

        callback = function () {
            grid.reload();
        };

    });

    //查询客户详情
    function showCstDtl(_cstId){
        Add_navTab("MCR_CST_CR_LIM_SCH_"+_cstId, "客户信息", '<%=path%>/customer/cstbscinfo/toCustDetailPage.do?id='+_cstId, null);
    }

    //格式化时间
    function renderDate(rowdata, index, value) {
        var dateStr = "";
        if (null != value) {
            var date = new Date(value);
            dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DDHHMMSS);
        }
        return dateStr;
    }
</script>

</body>
</html>
